-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PS-7745 - Stored procedure execution fails if contains a functional index #4854
Open
avodaniel
wants to merge
2
commits into
percona:8.0
Choose a base branch
from
tempesta-tech:daniel/8.0/PS-7745
base: 8.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
avodaniel
force-pushed
the
daniel/8.0/PS-7745
branch
3 times, most recently
from
August 21, 2022 19:47
4a88e2d
to
3b86c19
Compare
avodaniel
force-pushed
the
daniel/8.0/PS-7745
branch
2 times, most recently
from
August 28, 2022 20:36
a896333
to
60b158f
Compare
…tional index) https://jira.percona.com/browse/PS-7745 **Problem:** A Stored Procedure execution fails after some executions when a functional index is present in the SP definition. The error behaves differently depending on the versions I tested: 8.0.23 (PS, Community): It only fails when using a temporary table. After the third execution, all the subsequent executions fail. 8.0.25 (Community): It also fails on normal tables. How to Repeat ``` DROP PROCEDURE IF EXISTS `sproc`; DELIMITER $$ CREATE PROCEDURE `sproc`() BEGIN DROP TEMPORARY TABLE IF EXISTS `T1`; CREATE TEMPORARY TABLE `T1`( `C1` INT, KEY ( ( `C1` > 0 ) ) ); SELECT 1 FROM ( SELECT 1 `C2` ) `T2`; END$$ DELIMITER ; Now if you invoke that procedure 3 times in a row: mysql> CALL `sproc`(); CALL `sproc`(); CALL `sproc`(); +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) ERROR 3107 (HY000): Generated column can refer only to generated columns defined prior to it. On 8.0.25 (Community) The error is ERROR 3754 (HY000): Functional index 'functional_index' cannot refer to an auto-increment column. ``` **Cause:** The issue happens when checks are performed again during a query in the function `pre_validate_value_generator_expr()` and column index of the functional index is not available. **Solution:** This solution disables some checks if a column index is not available in the function `pre_validate_value_generator_expr()` during the second and later queries. It is safe because these checks are done in the function `validate_value_generator_expr()` during the first query. The column index is available there.
avodaniel
force-pushed
the
daniel/8.0/PS-7745
branch
from
February 8, 2023 08:16
60b158f
to
4e6484d
Compare
LenzGr
changed the title
Fix of PS-7745
PS-7745 - Stored procedure execution fails if contains a functional index
Feb 28, 2023
dutow
reviewed
Mar 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! With one simple comment.
@@ -0,0 +1,18 @@ | |||
--source include/have_rocksdb.inc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't specific to rocksdb.
Could you move the testcase to the proper directory and remove this check?
… a functional index)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.